<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>apple搜索框</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<style>
*{ margin:0; padding:0;}
.clear { clear:both;}
.bar { width:1002px; height:36px; margin:100px auto; background:#000;}
ul,li {list-style:none; margin:0; padding:0;}
.nav {float:left;height:36px;overflow:hidden;}
.nav li {float:left; height:36px; line-height:36px; width:102px; overflow:hidden; border-right:1px #555 solid;}
.nav li a { font-family:Arial; font-size:14px;display:block; padding:0px 10px; text-decoration:none; text-align:center;color:#fff;}
.nav li a:hover {background:#f60}

.searchbox { float:right;height:36px; padding-right:10px;}
.search_box {height:20px; margin-top:6px;}
.search {height:20px; line-height:20px;padding:0px 10px; border:1px #ddd solid; background:#fff;outline: none; width:100px;}
</style>
<script type="text/javascript">
$(document).ready(function(){
 
 $(".search").focus(function(){
  $(this).stop(true,false).animate({width:"200px"},"slow");
  var navwidth = 720;
  var liwidth = navwidth/8;
  $("ul.nav li").animate({width:liwidth+"px"},"slow");
 })
 .blur(function(){
  $(this).animate({width:"100px"},"slow");
  var navwidth = 820;
  var liwidth = navwidth/8;
  $("ul.nav li").animate({width:liwidth+"px"},"slow");
 });
 
 //动态生成导航栏目的宽度
  
});
</script>
</head>

<body>
<div class="bar">
    <ul class="nav">
        <li><a href="#">Home</a></li>
        <li><a href="#">Works</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Mircblog</a></li>
        <li><a href="#">DJmusic</a></li>
    </ul>
    <div class="searchbox">
    <form class="search_box" action="http://www.baidu.com/s" target="_blank">
    <input class="search" type="text" name="wd" id="kw" value="搜索" />
    </form>
    </div>
    <div class="clear"></div>
</div>
</body>
</html>